package com.yunhe.authority.controller.authority;

import com.yunhe.authority.domain.authority.ProjectTree;
import com.yunhe.authority.service.authority.ProjectTreeService;
import com.yunhe.common.model.ResultObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName ProjectTreeController
 * @Description TODO
 * @Author HeTao
 * @Date 2021/2/24 17:39
 * @Version 1.0
 **/
@Api(value = "projectTree",description = "项目树", tags = {"Authority_ProjectTree"})
@RestController
@RequestMapping("/projectTree")
public class ProjectTreeController {

    @Autowired
    private ProjectTreeService projectTreeService;

    @ApiOperation("关联的项目信息")
    @RequestMapping(value = "/getAllProject",method = RequestMethod.GET)
    public ResponseEntity<ResultObject> getAllProject() {
        List<ProjectTree> projectTreeList = projectTreeService.getAllProject();
        return new ResponseEntity<>(new ResultObject<>(projectTreeList), HttpStatus.OK);
    }

    @ApiOperation("系统单位项目树")
    @RequestMapping(value = "/getTree",method = RequestMethod.GET)
    public ResponseEntity<ResultObject> getTree() {
        List<ProjectTree> projectTreeList = projectTreeService.getTree();
        return new ResponseEntity<>(new ResultObject<>(projectTreeList), HttpStatus.OK);
    }

    @ApiOperation("单位项目真实园区树")
    @RequestMapping(value = "/getRealStationTree",method = RequestMethod.GET)
    public ResponseEntity<ResultObject<List<ProjectTree>>> getRealStationTree() {
        List<ProjectTree> projectTreeList = projectTreeService.getRealStationTree();
        return new ResponseEntity<>(new ResultObject<>(projectTreeList), HttpStatus.OK);
    }

    @ApiOperation("虚拟园区真实园区树")
    @RequestMapping(value = "/getStationUntilRealStationTree",method = RequestMethod.GET)
    public ResponseEntity<ResultObject<List<ProjectTree>>> getStationUntilRealStationTree() {
        List<ProjectTree> projectTreeList = projectTreeService.getStationUntilRealStationTree();
        return new ResponseEntity<>(new ResultObject<>(projectTreeList), HttpStatus.OK);
    }
}
